
#include"Endgame.h"
#include"HelloWorldScene.h"
using namespace cocos2d;
using namespace ui;

Scene* Endgame::createScene()
{
	auto scene = Scene::create();
	auto layer = Endgame::create();
	scene->addChild(layer);
	return scene;
}

bool Endgame::init()
{

	if (!Layer::init())
	{
		return false;
	}
	auto listener1 = EventListenerTouchOneByOne::create();
	listener1->onTouchBegan = CC_CALLBACK_2(Endgame::onTouchBegan, this);
	_eventDispatcher->addEventListenerWithSceneGraphPriority(listener1, this);
	return true;
}

bool Endgame::onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event)
{
	Scene *newGameScene = Scene::create();
	HelloWorld * story = HelloWorld::create();
	newGameScene->addChild(story);
	auto ss = TransitionFade::create(1, newGameScene);
	Director::getInstance()->replaceScene(ss);
	return true;
}